package com.company;

/**
 * @date : 2022-11-24 下午8:21
 * 普通方法调用
 * @see com.company.P030_GenericMethodCall
 */

public class P031_PlainMethodCall {

    public static void main(String[] args) {
        AppleServiceImpl appleService = new AppleServiceImpl();
        appleService.method();
        BananaServiceImpl bananaService = new BananaServiceImpl();
        bananaService.method();
    }

    public static class AppleServiceImpl extends AbstractFruitService {
        public void method() {
            System.out.println(check(""));
        }

        @Override
        boolean verify(String o) {
            return false;
        }
    }

    public static class BananaServiceImpl extends AbstractFruitService {
        public void method() {
            System.out.println(check(""));
        }

        @Override
        boolean verify(String o) {
            return true;
        }
    }

    public static abstract class AbstractFruitService {
        public boolean check(String o) {
            return verify(o);
        }

        abstract boolean verify(String o);
    }
}
